﻿#pragma warning(disable: 4996)
#pragma warning(disable: 6031)

#include <stdio.h>

void solve(int d) {
	d = (d + 2) % 7;
	if (d == 0)d = 7;
	printf("%d", d);
}

int main()
{
	freopen("D:/Develop/GitRepos/MOOC/浙江大学/数据结构/201906/DataStructure/M2019秋C入门和进阶练习集/7-13.txt", "r", stdin);
	int d;
	scanf("%d", &d);
	solve(d);
	return 0;
}